import Vue from 'vue'
import Router from 'vue-router'
import style from '@/style'
import SystemRouter from './modules/system'
import BugRouter from './modules/bug'
import TaskRouter from './modules/task'
import AssetRouter from './modules/asset'
import ScriptRouter from './modules/script'
import ScanRouter from './modules/scan'
import CodeRouter from './modules/code'
import ComponentsRouter from './modules/components'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/main/dashboard'
    },
    {
      path: '/main',
      name: 'main',
      redirect: 'dashboard',
      component: style,
      children: [
        // 首页
        {
          name: 'dashboard',
          path: 'dashboard',
          components: {
            content: require('@/views/dashboard/dashboard').default
          }
        }
      ]
    },

    // 系统管理
    SystemRouter,
    // 漏洞管理
    BugRouter,
    // 任务管理
    TaskRouter,
    // 资产管理
    AssetRouter,
    // 脚本管理
    ScriptRouter,
    // 扫描管理
    ScanRouter,
    // 代码生成器
    CodeRouter,
    // 组件管理
    ComponentsRouter,

    {
      path: '/login',
      name: 'login',
      component: require('@/views/Login').default
    },
    {
      path: '/index-ice',
      name: 'index-ice',
      component: require('@/views/style/ice/index').default
    },
    {
      path: '/index-zui',
      name: 'indexZui',
      component: style
    },
    {
      path: '/404',
      component: style,
      children: [
        {
          path: '',
          components: {
            content: require('@/views/common/blank-page').default
          }
        }
      ]
    },
    {
      path: '*',
      component: style,
      children: [
        {
          path: '',
          components: {
            content: require('@/views/common/blank-page').default
          }
        }
      ]
    }
  ]
})
